package com.bilicraft.plugin.kexue.jsonapi;

import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;

/** due to apply handlers for JSONAPI*/
public class JSONAPIActivator implements Runnable{

	public static void act(){
		Thread t = new Thread(new JSONAPIActivator());
		t.start();
	}
	
	@Override
	public void run() {
		while(true){
			try{
				if(JSONAPIHandler.isEnable){
					break;
				}
				Plugin ck = Bukkit.getServer().getPluginManager().getPlugin("JSONAPI");
				if(ck != null && ck.isEnabled()){
					JSONAPIHandler.enable();
					break;
				}else{
					Thread.sleep(100L);
				}
			}catch(Exception e){
				e.printStackTrace();
			}
		}
	}

}
